{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1a955205-3348-4fcd-8a02-1bdd1d580c1a",
   "metadata": {},
   "source": [
    "Chapter 05\n",
    "\n",
    "# 相关性距离\n",
    "Book_6《数据有道》 | 鸢尾花书：从加减乘除到机器学习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1ae8eab2-682c-4c08-9419-12bd3684626c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from scipy.spatial import distance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2f6c0270-f04a-4f77-b4e4-a1916b97f753",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.array([8, 2])\n",
    "q = np.array([7, 9])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "caf778dc-f817-4913-b3be-31beb6443126",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.0\n"
     ]
    }
   ],
   "source": [
    "d_x_q = distance.correlation(x,q)\n",
    "print(d_x_q)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
